import { defineStore } from 'pinia'

interface CacheItem {
  name: string;
  lastAccess: number;
}

export const useKeepAliveStore = defineStore('keepAlive', {
  state: (): {
    cachedViews: string[];
    cacheRecords: CacheItem[]
  } => {
    return {
       cachedViews: [],
       cacheRecords:[]
    };
  },
  actions: {
    clearAllCache() {
      this.cachedViews = []
      this.cacheRecords = []
    }
  },
})